﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;

public partial class Kho_SoanHang_ChiTiet : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
        if ((Session["UserID"] == null) || (!CheckPermission("kview")))
        {
            Response.Redirect("~/home");
        }
        else
        {
            try
            {
                int buoiid = Convert.ToInt32(HttpContext.Current.Items["buoi"]);
                string strngayxuat = HttpContext.Current.Items["ngay"].ToString();
                DateTime ngayxuat = DateTime.ParseExact(strngayxuat, "ddMMyyyy", CultureInfo.InvariantCulture);
                int id = Convert.ToInt32(HttpContext.Current.Items["id"].ToString());
                uc_SoanHang_ChiTiet1._ID = id;
                uc_SoanHang_ChiTiet1._BuoiID = buoiid;
                uc_SoanHang_ChiTiet1._Ngay = ngayxuat;
            }
            catch
            {

                Response.Redirect("~/home");
            }
            
        }

    }
    private bool CheckPermission(string func)
    {
       if (Session["Permission"] != null)
        {
            foreach (string item in Session["Permission"].ToString().Split(','))
            {
                if (item == func)
                {
                    return true;
                }
            }
            return false;
        }
        else
        {
            return false;
        }

    }
}